﻿' ------------------------------------------------------------------------------
' The following enumerations define the
'
' - well-known text coordinate ordering (EnumCoordinateOrder)
' - image types (EnumImageType)
' - database authorization methods (EnumConnectionAuth).
'
' ------------------------------------------------------------------------------
' This file is part of the SQL Server 2008 Technology Demonstration. This
' application was designed and coded by Eric Weitzman, LandTime Inc, for
' Microsoft Corporation. Contact Ed Katibah at Microsoft about this demo.
' Copyright © 2008 Microsoft Corporation. All rights reserved.
' ------------------------------------------------------------------------------

Public Module Enums

    ' Latitude/Longitude coordinate order to use in OpenGIS Consortiums' well-known
    ' text (OGC WKT) representations.
    '
    ' Different versions of SQL Server 2008 use different coordinate ordering
    ' for the well-known text representations of geography types. Up to and
    ' including build 10.0.1300.13 (CTP6), the order was (latitude longitude),
    ' represented by EnumCoordinateOrder.eLatitudeLongitudeObsolete. After that,
    ' the order is (longitude latitude), represented by
    ' EnumCoordinateOrder.eLongitudeLatitude.
    '
    ' For example, a point located at the Weed airport near Mt. Shasta in California
    ' would have the following well-known text representations:
    '
    ' old: POINT(41.47667 -122.454)
    ' new: POINT(-122.454 41.47667)
    '
    ' The coordinate order used for geometry types is consistent across builds and
    ' is always (X Y). Note thate there is a distinction between geography and 
    ' geometry types.

    Public Enum EnumCoordinateOrder
        eUnknown
        eLatitudeLongitudeObsolete
        eLongitudeLatitude
    End Enum

    ' Describes the type of an image/image file

    Public Enum EnumImageType
        eNone
        eBmp
        eGif
        eJpg
        ePng
        eTif
        eWmp
    End Enum

    ' Type of authorization to use when connecting to SQL Server

    Public Enum EnumConnectionAuth
        eUnknown
        eSqlServer
        eWindows
    End Enum

    Public Function AuthToString(ByVal authval As EnumConnectionAuth) As String
        Return [Enum].GetName(GetType(EnumConnectionAuth), authval)
    End Function

    Public Function StringToAuth(ByVal authstring As String) As EnumConnectionAuth
        Try
            Return DirectCast([Enum].Parse(GetType(EnumConnectionAuth), authstring), EnumConnectionAuth)
        Catch ex As Exception
            Return EnumConnectionAuth.eUnknown
        End Try
    End Function

    ' SQL activities that are reported to the client as events

    Public Enum EnumSqlEvent
        eNone
        eCommand
        eOperation
        eOpenSqlFilestreamError
    End Enum

End Module
